package com.ztc.ZtcRouteSite.web;
import java.util.HashMap;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ztc.ZtcRouteSite.bean.ZtcRouteSite;
import com.ztc.ZtcRouteSite.service.ZtcRouteSiteManager;
@Controller
@RequestMapping("ztc_route_site_action")
public class ZtcRouteSiteAction{
    @Autowired
    private ZtcRouteSiteManager  ztcRouteSiteManager;
    @RequestMapping("init")
    @ResponseBody
    /**
     * 获得某趟班次的所有站点
     * @return 某趟班次的所有站点集合
     */
    public HashMap<String, Object> getAll() {
        List<ZtcRouteSite> list = ztcRouteSiteManager.getAll();
        HashMap<String, Object> wapper = new HashMap<>();
        wapper.put("success", Boolean.valueOf(true));
        wapper.put("data", list);
        return wapper;
    }

    @RequestMapping("searchInfoLikes")
    @ResponseBody
    /**
     * 根据名称和城市模糊查找线路站点
     * @param name 名称
     * @param areaCity 城市
     * @return 线路站点集合
     */
    public HashMap<String, Object> searchInfoLikes(String name,String areaCity) {
        List<ZtcRouteSite> list = ztcRouteSiteManager.searchInfoLikes(name,areaCity);
        HashMap<String, Object> wapper = new HashMap<>();
        wapper.put("success", Boolean.valueOf(true));
        wapper.put("data", list);
        return wapper;
    }
}